package com.bhkj.pdjhbgnewproject.core.main;

import android.support.annotation.Nullable;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bhkj.pdjhbgnewproject.R;
import com.blankj.utilcode.util.SizeUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

public class MainAdapter extends BaseQuickAdapter<String, BaseViewHolder> {


    public MainAdapter(int layoutResId, @Nullable List<String> data) {
        super(layoutResId, data);

    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        TextView waitNumTv = helper.getView(R.id.tv_wait_num);
        waitNumTv.setText(item);
        setMarginStart(waitNumTv, helper.getAdapterPosition());
    }

    private void setMarginStart(TextView tv, int index) {
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        if (index == 1 || index == 3 || index == 6) {
            params.leftMargin = SizeUtils.dp2px(20);
        }
        tv.setLayoutParams(params);
    }
}
